package 康复训练_JavaGo并驾齐驱;

import 链表.ListNode;

public class Jz24反转链表 {

    public ListNode reverseList(ListNode head) {

        // A -> B -> C
        ListNode last = null;
        ListNode next = null;
        ListNode node = head;

        while (node != null) {
            next = node.next;
            node.next = last;
            last = node;
            node = next;
        }

        return last;
    }

}
